package com.lujianfei.productprice.ui.order;

import android.os.Parcel;
import android.os.Parcelable;

import com.orm.SugarRecord;
import com.orm.dsl.Column;
import com.orm.dsl.Ignore;
import com.orm.dsl.Table;

@Table(name = "OrderDetailEntity")
public class OrderDetailEntity extends SugarRecord implements Parcelable {

    @Column(name = "orderId")
    private long orderId;

    @Column(name = "shopId")
    private long shopId;

    @Column(name = "shopName")
    private String shopName;

    @Column(name = "productId")
    private long productId;

    @Column(name = "productName")
    private String productName;

    @Column(name = "quantity")
    private int quantity;

    @Column(name = "price")
    private double price;

    @Column(name = "totalPrice")
    private double totalPrice;

    @Ignore
    private boolean showShopName;

    public OrderDetailEntity() {
    }

    public boolean isShowShopName() {
        return showShopName;
    }

    public void setShowShopName(boolean showShopName) {
        this.showShopName = showShopName;
    }

    public long getOrderId() {
        return orderId;
    }

    public void setOrderId(long orderId) {
        this.orderId = orderId;
    }

    public long getShopId() {
        return shopId;
    }

    public void setShopId(long shopId) {
        this.shopId = shopId;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public long getProductId() {
        return productId;
    }

    public void setProductId(long productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    protected OrderDetailEntity(Parcel in) {
        orderId = in.readLong();
        shopId = in.readLong();
        shopName = in.readString();
        productId = in.readLong();
        productName = in.readString();
        quantity = in.readInt();
        price = in.readDouble();
        totalPrice = in.readDouble();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(orderId);
        dest.writeLong(shopId);
        dest.writeString(shopName);
        dest.writeLong(productId);
        dest.writeString(productName);
        dest.writeInt(quantity);
        dest.writeDouble(price);
        dest.writeDouble(totalPrice);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<OrderDetailEntity> CREATOR = new Creator<OrderDetailEntity>() {
        @Override
        public OrderDetailEntity createFromParcel(Parcel in) {
            return new OrderDetailEntity(in);
        }

        @Override
        public OrderDetailEntity[] newArray(int size) {
            return new OrderDetailEntity[size];
        }
    };
}
